home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2005 October / PCWOCT05.iso / Software / FromTheMag / The GIMP 2.2.8 / gimp-2.2.8-i586-setup.exe / {app} / share / gimp / 2.0 / scripts / erase-rows.scm < prev    next >
Encoding:
Text File  |  2005-06-30  |  1.5 KB  |  42 lines

  1. (define (script-fu-erase-rows img drawable orientation which type)
  2.   (let* ((width (car (gimp-drawable-width drawable)))
  3.      (height (car (gimp-drawable-height drawable)))
  4.      (position-x (car (gimp-drawable-offsets drawable)))
  5.      (position-y (cadr (gimp-drawable-offsets drawable))))
  6.     (gimp-image-undo-group-start img)
  7.     (letrec ((loop (lambda (i max)
  8.              (if (< i max)
  9.              (begin
  10.                (if (= orientation 0)
  11.                    (gimp-rect-select img position-x (+ i position-y) width 1 CHANNEL-OP-REPLACE FALSE 0)
  12.                    (gimp-rect-select img (+ i position-x) position-y 1 height CHANNEL-OP-REPLACE FALSE 0))
  13.                (if (= type 0)
  14.                    (gimp-edit-clear drawable)
  15.                    (gimp-edit-fill drawable BACKGROUND-FILL))
  16.                (loop (+ i 2) max))))))
  17.       (loop (if (= which 0)
  18.         0
  19.         1)
  20.         (if (= orientation 0)
  21.         height
  22.         width)))
  23.     (gimp-selection-none img)
  24.     (gimp-image-undo-group-end img)
  25.     (gimp-displays-flush)))
  26.  
  27. (script-fu-register "script-fu-erase-rows"
  28.             _"_Erase every other Row..."
  29.             "Erase every other row/column with the background color"
  30.             "Federico Mena Quintero"
  31.             "Federico Mena Quintero"
  32.             "June 1997"
  33.             "RGB* GRAY* INDEXED*"
  34.             SF-IMAGE     "Image"      0
  35.             SF-DRAWABLE  "Drawable"   0
  36.             SF-OPTION   _"Rows/cols"  '(_"Rows"  _"Columns")
  37.             SF-OPTION   _"Even/odd"   '(_"Even"  _"Odd")
  38.             SF-OPTION   _"Erase/fill" '(_"Erase" _"Fill with BG"))
  39.  
  40. (script-fu-menu-register "script-fu-erase-rows"
  41.              _"<Image>/Script-Fu/Alchemy")
  42.